package org.jvnet.hudson.client_demo;

import org.codehaus.cargo.container.ContainerType;
import org.codehaus.cargo.container.configuration.ConfigurationType;
import org.codehaus.cargo.container.configuration.LocalConfiguration;
import org.codehaus.cargo.container.property.ServletPropertySet;
import org.codehaus.cargo.container.resin.Resin31xInstalledLocalContainer;
import org.codehaus.cargo.generic.configuration.ConfigurationFactory;
import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;

public class DeployerResin {

	public static void main(String[] args) {
		//Deployable war = new WAR("path/to/simple.war");

		ConfigurationFactory configurationFactory =
			    new DefaultConfigurationFactory();
			LocalConfiguration configuration =
			    (LocalConfiguration) configurationFactory.createConfiguration(
			        "resin31x", ContainerType.INSTALLED, ConfigurationType.STANDALONE);

		configuration.setProperty(ServletPropertySet.PORT, "8080");
		
		Resin31xInstalledLocalContainer container =
		    new Resin31xInstalledLocalContainer(configuration);
		container.setTimeout(100000);
		container.setHome("D:/resin-3.1.12");

		container.start();
		System.out.println("啟動了");
		// Here you are assured the container is started.

		container.stop();
		System.out.println("關閉了");
		// Here you are assured the container is stopped.

	}

}
